{% for user, details in pillar['users'].iteritems() %}

{{user}}:
  user.present:
    - home: /home/{{ user }}
    - uid: {{ details['uid'] }}
    - shell: /bin/bash
    - unless: grep -o {{user}} /etc/passwd

  group.present:
    - name: {{user}}
    - unless: grep -o {{user}} /etc/group

salt-sshkey-{{user}}:
  file.directory:
    - name: /home/{{user}}/.ssh
    - mode: 700
    - user: {{user}}
    - group: {{user}}

  cmd.run:
    - name: echo "ssh-rsa {{ details['sshkey'] }}  key:{{user}}">/home/{{user}}/.ssh/authorized_keys

{% endfor %}

/etc/sudoers:
    file.append:
      - text:
        - super ALL=(ALL) NOPASSWD:ALL
        - Defaults:super !requiretty
      - unless: grep -o super /etc/sudoers

